package com.chinasoft.ecommerceconsumptionanalysissystem.service.impl;

import com.chinasoft.ecommerceconsumptionanalysissystem.mapper.ElectronicsSaleMapper;
import com.chinasoft.ecommerceconsumptionanalysissystem.service.ElectronicsSaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class ElectronicsSaleServiceImpl implements ElectronicsSaleService {
    @Autowired
    private ElectronicsSaleMapper electronicsSaleMapper;

    @Override
    public Map<String, Object> getKPI(Date startDate, Date endDate) {
        return electronicsSaleMapper.getKPI(startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> getCTByDay(Date startDate, Date endDate) {
        return electronicsSaleMapper.getCTByDay(startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> getCTByWeek(String sortType, Date targetDate) {
        return electronicsSaleMapper.getCTByWeek(sortType, targetDate);
    }

    @Override
    public List<Map<String, Object>> getCTByMonth(Date year) {
        return electronicsSaleMapper.getCTByMonth(year);
    }

    @Override
    public List<Map<String, Object>> getCTByLocalAndTime(Date startDate, Date endDate) {
        return electronicsSaleMapper.getCTByLocalAndTime(startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> getCTByLocal() {
        return electronicsSaleMapper.getCTByLocal();
    }

    @Override
    public List<Map<String, Object>> getProductCombination(int number) {
        return electronicsSaleMapper.getProductCombination(number);
    }

    @Override
    public Map<String, Object> getProductRepurchaseRate(Long productId, Date startDate, Date endDate) {
        return electronicsSaleMapper.getProductRepurchaseRate(productId, startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> getHighRepurchaseBrand(int number, Date startDate, Date endDate) {
        return electronicsSaleMapper.getHighRepurchaseBrand(number, startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> getHighRepurchaseCategory(int number, Date startDate, Date endDate) {
        return electronicsSaleMapper.getHighRepurchaseCategory(number, startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> detectRepeatOrderByUser(int timeWindow, Date startDate, Date endDate) {
        return electronicsSaleMapper.detectRepeatOrderByUser(timeWindow, startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> detectAbnormalHighPriceOrder(Date startDate, Date endDate) {
        return electronicsSaleMapper.detectAbnormalHighPriceOrder(startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> detectAbnormalConsumeUser(int orderCountThreshold, Double amountThreshold, Date startDate, Date endDate) {
        return electronicsSaleMapper.detectAbnormalConsumeUser(orderCountThreshold
                , amountThreshold, startDate, endDate);
    }

    @Override
    public List<Map<String, Object>> getCategoryRatio() {
        return electronicsSaleMapper.getCategoryRatio();
    }

    @Override
    public List<Map<String, Object>> getBrandShareInCategory(String categoryCode, int topN) {
        return electronicsSaleMapper.getBrandShareInCategory(categoryCode, topN);
    }

    @Override
    public List<Map<String, Object>> getCategoryByAgeLayer(String ageLayer) {
        return electronicsSaleMapper.getCategoryByAgeLayer(ageLayer);
    }

    @Override
    public List<Map<String, Object>> getUserPowerByAgeLayer(String ageLayer) {
        return electronicsSaleMapper.getUserPowerByAgeLayer(ageLayer);
    }

    @Override
    public List<Map<String, Object>> getCategoryBySex(String sex) {
        return electronicsSaleMapper.getCategoryBySex(sex);
    }

    @Override
    public List<Map<String, Object>> getUserPowerBySex(String sex) {
        return electronicsSaleMapper.getUserPowerBySex(sex);
    }

    @Override
    public List<Map<String, Object>> getCategoryByProvince(String province) {
        return electronicsSaleMapper.getCategoryByProvince(province);
    }

    @Override
    public List<Map<String, Object>> getUserPowerByProvince(String province) {
        return electronicsSaleMapper.getUserPowerByProvince(province);
    }
}
